package com.fenxiangle.yueding.feature.publish.model;

import android.text.TextUtils;

import com.fenxiangle.yueding.entity.bo.FoucsBo;
import com.fenxiangle.yueding.entity.bo.OrderBo;
import com.fenxiangle.yueding.entity.bo.PageBo;
import com.fenxiangle.yueding.entity.bo.PublishBo;
import com.fenxiangle.yueding.entity.bo.PublishDemandBo;
import com.fenxiangle.yueding.entity.bo.UserCenterBo;
import com.fenxiangle.yueding.feature.mine.dependencies.mine.DaggerMineModelComponent;
import com.fenxiangle.yueding.feature.publish.contract.PublishContract;
import com.fenxiangle.yueding.feature.publish.dependencies.mine.DaggerPublishModelComponent;
import com.fenxiangle.yueding.framework.api.ApiLib;
import com.fenxiangle.yueding.framework.api.UserApi;
import com.suozhang.framework.component.http.RxDataProcessFactory;

import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.inject.Inject;

import io.reactivex.Observable;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;

public class PublishModel implements PublishContract.Model {

    @Inject
    UserApi api;


    @Inject
    public PublishModel() {
        DaggerPublishModelComponent.builder().apiComponent(ApiLib.apiComponent()).build().inject(this);
    }


    @Override
    public Observable<OrderBo> publishDemand(PublishBo publishBo) {
        return api.publishDemand(publishBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<OrderBo> publishInvite(PublishBo publishBo) {
        return api.publishinvite(publishBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<List<PublishDemandBo>> getPublishDemandList(PageBo publishBo) {
        return api.getPublishDemandList(publishBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<List<PublishDemandBo>> getPublishInviteList(PageBo publishBo) {
        return api.getPublishInviteList(publishBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> cancleInvitedOrder(OrderBo publishBo) {
        return api.cancleInviteOrder(publishBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> confrimInvitedOrder(OrderBo publishBo) {
        return api.confrimOrder(publishBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<PublishBo> txOrder(OrderBo publishBo) {
        return api.toTxComment(publishBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }

    @Override
    public Observable<String> txWeiquan(OrderBo publishBo) {
        return api.toweiqian(publishBo).compose(RxDataProcessFactory.dataPrepAndIoToMainTransformer());
    }
}
